﻿<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:sc="clr-namespace:SilverlightContrib.Controls;assembly=SilverlightContrib.Controls"
    xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows">
    
    <Style TargetType="sc:ColorPicker">
        <Setter Property="Width" Value="200" />
        <Setter Property="Height" Value="200" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="sc:ColorPicker">
                    <StackPanel x:Name="RootElement">
                        <StackPanel Orientation="Horizontal">
                            <Canvas Width="20" Height="180">
                            <Rectangle x:Name="HueMonitor" Width="20" Height="180">
                                <Rectangle.Fill>
                                    <LinearGradientBrush StartPoint ="0,0" EndPoint="0,1">
                                        <GradientStop Offset="0.00" Color="#ffff0000"/>
                                        <GradientStop Offset="0.17" Color="#ffffff00"/>
                                        <GradientStop Offset="0.33" Color="#ff00ff00"/>
                                        <GradientStop Offset="0.50" Color="#ff00ffff"/>
                                        <GradientStop Offset="0.66" Color="#ff0000ff"/>
                                        <GradientStop Offset="0.83" Color="#ffff00ff"/>
                                        <GradientStop Offset="1.00" Color="#ffff0000"/>
                                    </LinearGradientBrush>
                                </Rectangle.Fill>
                            </Rectangle>                              
                            <Canvas x:Name="HueSelector" IsHitTestVisible="False" Height="8" Canvas.Left="0" Canvas.Top="-4">
                                <Path Width="5" Height="8" Stretch="Fill" StrokeLineJoin="Round" Stroke="#FF000000" Fill="#FF000000" Data="F1 M 276.761,316L 262.619,307.835L 262.619,324.165L 276.761,316 Z " />
                                <Path Width="5" Height="8" Canvas.Top="8" Canvas.Left="20" Stretch="Fill" StrokeLineJoin="Round" Stroke="#FF000000" Fill="#FF000000" Data="F1 M 276.761,316L 262.619,307.835L 262.619,324.165L 276.761,316 Z ">
                                    <Path.RenderTransform>
                                        <RotateTransform Angle="180" />
                                    </Path.RenderTransform>
                                </Path>
                            </Canvas>
                            </Canvas>
                            <Canvas Canvas.Top="0" Canvas.Left="20">
                                <Rectangle x:Name="ColorSample" Width="180" Height="180" Fill="Red"></Rectangle>
                                <Rectangle x:Name="WhiteGradient" IsHitTestVisible="False" Width="180" Height="180">
                                    <Rectangle.Fill>
                                        <LinearGradientBrush StartPoint="0,0" EndPoint="1,0">
                                            <GradientStop Offset="0" Color="#ffffffff"/>
                                            <GradientStop Offset="1" Color="#00ffffff"/>
                                        </LinearGradientBrush>
                                    </Rectangle.Fill>
                                </Rectangle>
                                <Rectangle x:Name="BlackGradient" IsHitTestVisible="False" Width="180" Height="180">
                                    <Rectangle.Fill>
                                        <LinearGradientBrush StartPoint="0,1" EndPoint="0, 0">
                                            <GradientStop Offset="0" Color="#ff000000"/>
                                            <GradientStop Offset="1" Color="#00000000"/>
                                        </LinearGradientBrush>
                                    </Rectangle.Fill>
                                </Rectangle>
                                <Canvas x:Name="SampleSelector" IsHitTestVisible="False" Width="10" Height="10" Canvas.Left="100" Canvas.Top="96">
                                    <Ellipse Width="10" Height="10" StrokeThickness="3" Stroke="#FFFFFFFF"/>
                                    <Ellipse Width="10" Height="10" StrokeThickness="1" Stroke="#FF000000"/>
                                </Canvas>
                            </Canvas>
                        </StackPanel>
                        
                        <StackPanel Orientation="Horizontal">
                            <Grid>
                                <Rectangle Width="60" Height="20" Fill="Black" />
                                <TextBlock x:Name="HexValue" 
                                           Foreground="White" 
                                           Text="#FF0000" 
                                           FontFamily="Arial" 
                                           FontSize="11" 
                                           TextAlignment="Center" 
                                           VerticalAlignment="Center" 
                                           HorizontalAlignment="Center" />
                            </Grid>
                            <Rectangle x:Name="SelectedColorView" Width="140" Height="20" Fill="Black" />
                        </StackPanel>
                    </StackPanel>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>


    <Style TargetType="sc:SliderGauge">
        <Setter Property="Height" Value="20" />
        <Setter Property="Width" Value="200" />
        <Setter Property="FontSize" Value="15" />
        <Setter Property="Orientation" Value="Horizontal" />
        <Setter Property="FontColor" Value="White" />
        <Setter Property="Foreground">
            <Setter.Value>
                <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                    <GradientStop Offset="0" Color="#FFB9FF87"/>
                    <GradientStop Offset="1" Color="#FF3BA521"/>
                </LinearGradientBrush>
            </Setter.Value>
        </Setter>
        <Setter Property="Background">
            <Setter.Value>
                <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                    <GradientStop Offset="0" Color="#FFC0C0C0"/>
                    <GradientStop Offset="1" Color="#FF303030"/>
                </LinearGradientBrush>
            </Setter.Value>
        </Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="sc:SliderGauge">
                    <Grid x:Name="RootElement">
                        <vsm:VisualStateManager.VisualStateGroups>
                            <vsm:VisualStateGroup x:Name="CommonStates">
                                <vsm:VisualStateGroup.Transitions>
                                    <vsm:VisualTransition GeneratedDuration="0:0:0.3" />
                                </vsm:VisualStateGroup.Transitions>
                                <vsm:VisualState x:Name="Normal" />
                                <vsm:VisualState x:Name="MouseDown">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="PercentageTextBlock" Storyboard.TargetProperty="Opacity" To="1" />
                                    </Storyboard>
                                </vsm:VisualState>
                            </vsm:VisualStateGroup>
                        </vsm:VisualStateManager.VisualStateGroups>

                        <Rectangle x:Name="ShadowElement" 
                                   RadiusX="3" 
                                   RadiusY="3" 
                                   Fill="{TemplateBinding Background}" 
                                   Stretch="Fill" />
                        
                        <Rectangle x:Name="HighlightElement" 
                                   RadiusX="3" 
                                   RadiusY="3" 
                                   Fill="{TemplateBinding Foreground}" 
                                   Stretch="Fill" />
                        
                        <TextBlock x:Name="PercentageTextBlock" 
                                   Foreground="{TemplateBinding FontColor}" 
                                   Opacity="0" 
                                   Visibility="Collapsed" 
                                   FontFamily="Arial" 
                                   HorizontalAlignment="Center" 
                                   VerticalAlignment="Center" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="sc:StarSelector">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="sc:StarSelector">
                    <Border BorderThickness="2" BorderBrush="#FFE0E0E0">
                        <Border.Background>
                            <LinearGradientBrush Opacity="0.75" EndPoint="0.5,1" StartPoint="0.5,0">
                                <GradientStop Color="#FFEEEEEE" Offset="0"/>
                                <GradientStop Color="#FFBDBDBD" Offset="1"/>
                            </LinearGradientBrush>
                        </Border.Background>
                        <StackPanel x:Name="RootElement" Orientation="Horizontal" HorizontalAlignment="Center">
                            <StackPanel.Resources>
                                <ControlTemplate x:Key="StarTemplate" >
                                    <Grid Margin="5">
                                        <vsm:VisualStateManager.VisualStateGroups>
                                            <vsm:VisualStateGroup x:Name="RatingModeStates">
                                                <vsm:VisualState x:Name="Normal"  />
                                                <vsm:VisualState x:Name="MouseOver">
                                                    <Storyboard>

                                                        <ColorAnimation
                                                            Storyboard.TargetName="StarPath" 
                                                            Storyboard.TargetProperty="(Shape.Stroke).(RadialGradientBrush.GradientStops)[0].(GradientStop.Color)" 
                                                            BeginTime="00:00:00" Duration="0:0:0" 
                                                            To="#FFFF9D00" />
                                                        <ColorAnimation
                                                            Storyboard.TargetName="StarPath" 
                                                            Storyboard.TargetProperty="(Shape.Stroke).(RadialGradientBrush.GradientStops)[1].(GradientStop.Color)" 
                                                            BeginTime="00:00:00" Duration="0:0:0" 
                                                            To="#FFFFC100" />

                                                        <ColorAnimation
                                                            Storyboard.TargetName="StarPath" 
                                                            Storyboard.TargetProperty="(Shape.Fill).(RadialGradientBrush.GradientStops)[0].(GradientStop.Color)" 
                                                            BeginTime="00:00:00" Duration="0:0:0" 
                                                            To="#FFFFFF00" />
                                                        <ColorAnimation
                                                            Storyboard.TargetName="StarPath" 
                                                            Storyboard.TargetProperty="(Shape.Fill).(RadialGradientBrush.GradientStops)[1].(GradientStop.Color)" 
                                                            BeginTime="00:00:00" Duration="0:0:0" 
                                                            To="#FFFF9200" />
                                                        
                                                    </Storyboard>
                                                </vsm:VisualState>
                                                <vsm:VisualState x:Name="Selected">
                                                    <Storyboard>

                                                        <ColorAnimation
                                                            Storyboard.TargetName="StarPath" 
                                                            Storyboard.TargetProperty="(Shape.Stroke).(RadialGradientBrush.GradientStops)[0].(GradientStop.Color)" 
                                                            BeginTime="00:00:00" Duration="0:0:0" 
                                                            To="#FFFF9D00" />
                                                        <ColorAnimation
                                                            Storyboard.TargetName="StarPath" 
                                                            Storyboard.TargetProperty="(Shape.Stroke).(RadialGradientBrush.GradientStops)[1].(GradientStop.Color)" 
                                                            BeginTime="00:00:00" Duration="0:0:0" 
                                                            To="#FFFFC100" />

                                                        <ColorAnimation
                                                            Storyboard.TargetName="StarPath" 
                                                            Storyboard.TargetProperty="(Shape.Fill).(RadialGradientBrush.GradientStops)[0].(GradientStop.Color)" 
                                                            BeginTime="00:00:00" Duration="0:0:0" 
                                                            To="#FFFFF500" />
                                                        <ColorAnimation
                                                            Storyboard.TargetName="StarPath" 
                                                            Storyboard.TargetProperty="(Shape.Fill).(RadialGradientBrush.GradientStops)[1].(GradientStop.Color)" 
                                                            BeginTime="00:00:00" Duration="0:0:0" 
                                                            To="#FFFF3900" />
                                                                                                               
                                                    </Storyboard>
                                                </vsm:VisualState>
                                            </vsm:VisualStateGroup>
                                        </vsm:VisualStateManager.VisualStateGroups>
                                        <Path Stretch="UniformToFill" Height="Auto" Width="Auto"
                                                Margin="2,2,2,2" StrokeThickness="1.5" StrokeLineJoin="Round" x:Name="StarPath"
                                                Data="F1 M 288,136L 219,136L 192,63.9999L 164.143,136L 96,136L 150.857,184L 123.429,256L 192,208L 260.571,256L 233.143,184L 288,136 Z ">
                                            <Path.Stroke>
                                                <RadialGradientBrush RadiusX="0.494924" RadiusY="0.494924" Center="0.5,0.5" GradientOrigin="0.5,0.5">
                                                    <RadialGradientBrush.GradientStops>
                                                        <GradientStop Color="#FF666666" Offset="0"/>
                                                        <GradientStop Color="#FFD4D4D4" Offset="1"/>
                                                    </RadialGradientBrush.GradientStops>
                                                </RadialGradientBrush>
                                            </Path.Stroke>
                                            <Path.Fill>
                                                <RadialGradientBrush RadiusX="0.507813" RadiusY="0.507813" Center="0.5,0.5" GradientOrigin="0.5,0.5">
                                                    <RadialGradientBrush.GradientStops>
                                                        <GradientStop Color="#FFF0F0EE" Offset="0"/>
                                                        <GradientStop Color="#FFA9A9A9" Offset="1"/>
                                                    </RadialGradientBrush.GradientStops>
                                                </RadialGradientBrush>
                                            </Path.Fill>
                                        </Path>                                   
                                    </Grid>
                                </ControlTemplate>
                            </StackPanel.Resources>
                        </StackPanel>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>


    <Style TargetType="sc:CoolMenu">
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="HorizontalAlignment" Value="Center" />
        <Setter Property="VerticalAlignment" Value="Bottom" />
        <Setter Property="Height" Value="100" />
        <Setter Property="ItemsPanel">
            <Setter.Value>
                <ItemsPanelTemplate>
                    <StackPanel Orientation="Horizontal" />
                </ItemsPanelTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="sc:CoolMenu">
                    <Grid Background="{TemplateBinding Background}"
                          HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
                          VerticalAlignment="{TemplateBinding VerticalAlignment}">
                    <ItemsPresenter />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="sc:CoolMenuItem">
        <Setter Property="VerticalAlignment" Value="Bottom" />
        <Setter Property="Background" Value="Transparent" />
        
        <Setter Property="RenderTransform">
            <Setter.Value>
                <TransformGroup>
                    <TranslateTransform />
                </TransformGroup>
            </Setter.Value>
        </Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="sc:CoolMenuItem">
                    <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
                        <Grid Background="{TemplateBinding Background}">
                            <ContentPresenter Content="{TemplateBinding Content}"
                                              ContentTemplate="{TemplateBinding ContentTemplate}" />
                        </Grid>
                    </Border>
                    </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="sc:GroupBox">
        <Setter Property="BorderBrush" Value="DarkGray"/>
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="Padding" Value="6"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="sc:GroupBox">
                    <Grid Background="{TemplateBinding Background}">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="*"/>
                        </Grid.RowDefinitions>
                        <Border BorderThickness="{TemplateBinding BorderThickness}" Grid.Row="1" Grid.RowSpan="2" BorderBrush="{TemplateBinding BorderBrush}" CornerRadius="3">
                            <Border.Clip>
                                <GeometryGroup FillRule="EvenOdd">
                                    <RectangleGeometry x:Name="FullRect" Rect="0,0,300,200"/>
                                    <RectangleGeometry x:Name="HeaderRect" Rect="6,0,100,100"/>
                                </GeometryGroup>
                            </Border.Clip>
                        </Border>
                        <ContentPresenter Grid.Row="2" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" Margin="{TemplateBinding Padding}"/>
                        <ContentControl x:Name="HeaderContainer" Margin="6,0,0,0" Grid.Row="0" Grid.RowSpan="2" HorizontalAlignment="Left">
                            <ContentPresenter Margin="3,0,3,0" ContentTemplate="{TemplateBinding HeaderTemplate}" Content="{TemplateBinding Header}"/>
                        </ContentControl>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>